<template>
	<!-- 获取一个数组，结构为[{date:'时间',info:'内容内容'}] -->
	<!-- @click事件返回点击标签元素的索引值 第一项为0 -->
	<view class="bg">
		<view class="steps">
			<view class="steps_item" v-for="(i, index) in infoList" :key="index">
				<view class="s_r">
					<view class="line" :style="{backgroundColor:index != 0?lineColor:'rgba(0,0,0,0)'}"></view>
					<view class="index border yearText_wrap" :style="{backgroundColor:backgroundColor,'border-color':borderColor}">
						<!-- {{ index + 1 }} -->
						<view class="yearText"><text>{{ i.YSteps_date }}</text></view>
					</view>
					
					<view class="line" :style="{backgroundColor:index != infoList.length-1?lineColor:'rgba(0,0,0,0)'}"></view>
				</view>
				<view class="s_l">
					<view class="info_item" @tap="topage(i)">
						<view class="">
							<view class="info_item_top">
								<uni-icons 
									:type="i.YSteps_state?'checkbox-filled':'info-filled'" 
									:color="i.YSteps_state?'#00C260':'#F95151'"
									size="30"
									class="icon"
								></uni-icons>
								<text class="state">{{i.YSteps_stateText}}</text>
							</view>
							<view v-if="i.YSteps_textTit" class="con" :style="{WebkitLineClamp:lineNum!=0?lineNum:''}">{{ i.YSteps_textTit }}</view>
							<view v-if="i.YSteps_textTime" class="con" :style="{WebkitLineClamp:lineNum!=0?lineNum:''}">{{ i.YSteps_textTime }}</view>
						</view>
						<view class="right">
							<view class="text">{{i.YSteps_state?'':'去年报'}}</view>
							<uni-icons type="right" size="24"></uni-icons>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'YSteps',
		props: {
			infoList: {
				type: Array,
				default: []
			},
			borderColor: {
				type: String,
				default: '#2589FF'
			},
			backgroundColor: {
				type: String,
				default: '#FFF'
			},
			lineColor: {
				type: String,
				default: '#FFF'
			},
			lineNum: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {};
		},
		onLoad(e) {
			//获取列表
		},
		methods: {
			topage(e) {
				this.$emit('click', e);
			},
		}
	};
</script>

<style lang="scss" scoped>
	page {
		// background-color: #f2f2f2;
	}

	.bg {
		// margin: 20upx 0;
		// background-color: #f2f2f2;
		display: flex;
	}

	.steps {
		display: flex;
		flex-direction: column;

		.steps_item {
			display: flex;

			.s_r {
				padding: 0 20rpx;
				display: flex;
				flex-direction: column;
				align-items: center;

				.line {
					flex: 1;
					width: 4rpx;
					background-color: #FFF;
				}

				.index {
					width: 30rpx;
					height: 30rpx;
					font-size: 24rpx;
					text-align: center;
					line-height: 30rpx;
					border-radius: 50rpx;
				}
				.border{
					border: 6rpx solid #fff;
					box-sizing: border-box;
				}
				.yearText_wrap{
					position: relative;
				}
				.yearText{
					white-space: nowrap;
					line-height: 1;
					position: absolute;
					left: 40rpx;
					top: -4rpx;
					font-weight: bold;
					font-size: 30rpx;
					color: #000;
				}
			}

			.s_l {
				width: 100%;
				margin-left: 130rpx;
				display: flex;
				flex-direction: column;
				padding: 20rpx 0;

				.info_item {
					width: 100%;
					background-color: #FFFFFF;
					margin-right: 30upx;
					border-radius: 10upx;
					display: flex;
					justify-content: space-between;
					align-items: center;
					padding: 30upx;
					padding-right: 6rpx;
					box-shadow: 0 10rpx 30rpx #ddd;
					
					.right{
						display: flex;
						align-items: center;
						
						.text{
							width: 90rpx;
							text-align: right;
							font-size: 28rpx;
							position: relative;
							top: -2rpx;
						}
					}
					
					.info_item_top{
						display: flex;
						flex-direction: inherit;
						align-items: center;
						
						.icon{
							position: relative;
							left: -6rpx;
						}
						
						.state{
							position: relative;
							margin-left: 10rpx;
						}
					}

					text {
						font-size: 36rpx;
						font-weight: 500;
						color: rgba(51, 51, 51, 1);
						line-height: 50rpx;
					}

					.con {
						font-size: 28rpx;
						font-weight: 400;
						color: rgba(102, 102, 102, 1);
						line-height: 40rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						padding-left: 2rpx;
						flex-direction: column;
						margin-top: 10rpx;
					}
				}

				.info_item:active {
					background-color: #f4f4f4;
				}
			}
		}
	}


	// .steps {
	// 	display: flex;
	// 	flex-direction: column;
	// 	margin: 0 30upx;

	// 	.steps_item {
	// 		display: flex;
	// 		align-items:center ;
	// 		background-color: #fff;
	// 		margin-top: 10rpx;
	// 		.s_r {
	// 			display: flex;
	// 			flex-direction: column;
	// 			align-items: center;
	// 			height: 100%;
	// 			background-color: #f3f;
	// 			flex: 1;
	// 			view {
	// 				height: 100%;
	// 				display: flex;
	// 				flex: 1;
	// 				height: 100%;
	// 				width: 5upx;
	// 			}

	// 			text {
	// 				display: flex;
	// 				flex-direction: column;
	// 				align-items: center;
	// 				width: 40upx;
	// 				line-height: 40upx;
	// 				height: 40upx;
	// 				border-radius: 50%;
	// 				background-color: #ff3838;
	// 				color: #ffffff;
	// 				font-size: 10px;
	// 			}
	// 		}
	// 	}
	// }

	// .info_list {
	// 	display: flex;
	// 	flex-direction: column;
	// 	flex: 1;

	// 	.info_item {
	// 		background-color: #fff;
	// 		height: 200upx;
	// 		margin: 20upx 0;
	// 		margin-right: 30upx;
	// 		border-radius: 10upx;
	// 		display: flex;
	// 		flex-direction: column;
	// 		justify-content: center;
	// 		padding: 0 30upx;

	// 		text {
	// 			font-size: 18px;
	// 			font-family: PingFangSC-Medium, PingFang SC;
	// 			font-weight: 500;
	// 			color: rgba(51, 51, 51, 1);
	// 			line-height: 25px;
	// 		}

	// 		view {
	// 			font-size: 14px;
	// 			font-family: PingFangSC-Regular, PingFang SC;
	// 			font-weight: 400;
	// 			color: rgba(102, 102, 102, 1);
	// 			line-height: 20px;
	// 			overflow: hidden;
	// 			text-overflow: ellipsis;
	// 			display: -webkit-box;
	// 			-webkit-line-clamp: 2;
	// 			flex-direction: column;
	// 		}
	// 	}

	// 	.info_item:active {
	// 		opacity: 0.6;
	// 	}
	// }
</style>
